import requests

url = "https://chinasoftinc.com/owa"

headers = {
    'User-Agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Mobile Safari/537.36'
}
b = 0

from retrying import retry
# 装饰器retry设置尝试次数  stop_max_attempt_number 为尝试次数 等于3就是尝试三次
@retry(stop_max_attempt_number=3)
def a():
    global b
    b += 1
    print('请求次数:{}'.format(b))
    r = requests.get(url=url, headers=headers, timeout=1)


a()
